﻿Friend Class ImportForm

    Private Editor As CodeEditor

    Public Sub New(ByVal Editor As CodeEditor)
        InitializeComponent()
        Me.Editor = Editor
    End Sub

    Private Sub ImportForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For Each DLL As String In IO.Directory.EnumerateFiles("C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client", "*.dll")
            CheckedListBox1.Items.Add(IO.Path.GetFileName(DLL))
        Next
        CheckedListBox1.SetItemChecked(CheckedListBox1.Items.IndexOf("mscorlib.dll"), True)
        CheckedListBox1.SetItemChecked(CheckedListBox1.Items.IndexOf("System.dll"), True)
        CheckedListBox1.SetItemChecked(CheckedListBox1.Items.IndexOf("System.Core.dll"), True)
        CheckedListBox1.SetItemChecked(CheckedListBox1.Items.IndexOf("System.Windows.Forms.dll"), True)
    End Sub


    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim ListOfImport As New List(Of String)
        For Each Import As String In CheckedListBox1.CheckedItems.OfType(Of String)()
            ListOfImport.Add("C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\" & Import)
        Next
        Editor.ImportedDLL = ListOfImport.ToArray
        Me.Cursor = Cursors.WaitCursor
        Editor.PerformImports()
        Me.Cursor = Cursors.Default
        Me.Close()
    End Sub
End Class